Skip to content

Exclude Apple platforms from _XOPEN_SOURCE definition#343

Merged
mkruskal-google merged 9 commits into
google:masterfrom
DrishtiTripathi2230:fix-265-exclude-apple-xopen-source
Jun 29, 2026
Merged

Exclude Apple platforms from _XOPEN_SOURCE definition#343
mkruskal-google merged 9 commits into
google:masterfrom
DrishtiTripathi2230:fix-265-exclude-apple-xopen-source

Conversation

@DrishtiTripathi2230

Copy link
Copy Markdown
Contributor

This addresses the macOS+GCC15 build failure discussed in
abseil/abseil-cpp#2095, per @mkruskal-google's suggestion there.

Background

#265 added _XOPEN_SOURCE 500 to fix a QNX-specific compile error,
excluding FreeBSD and OpenBSD. This wasn't tested against Apple
platforms at the time.

Problem

On Apple platforms, defining _XOPEN_SOURCE lowers __DARWIN_C_LEVEL,
hiding C11 additions like quick_exit/at_quick_exit. GCC 15's
libstdc++ <cstdlib> unconditionally re-exports these symbols, which
fails to compile when they're hidden:
error: 'quick_exit' has not been declared in '::'

Fix

Add __APPLE__ to the existing exclusion list alongside FreeBSD and
OpenBSD, consistent with how those platforms are already handled.

Testing

Verified with a CI workflow on a macos-latest runner + Homebrew GCC 15:

_XOPEN_SOURCE 500 was added in google#266 to fix a QNX-specific compile
error. On Apple platforms, defining it lowers __DARWIN_C_LEVEL,
hiding C11 additions like quick_exit/at_quick_exit. GCC 15's
libstdc++ <cstdlib> unconditionally re-exports these symbols,
which fails to compile when they're hidden by this macro.

Add __APPLE__ to the existing exclusion list alongside FreeBSD and
OpenBSD, consistent with how those platforms are already handled.

See abseil/abseil-cpp#2095
@mkruskal-google mkruskal-google merged commit c476b21 into google:master Jun 29, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants